package com.CloudDream.PlaceHolder;

import com.CloudDream.MoonCake;
import com.CloudDream.config.Config;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.entity.Player;

public class hook extends PlaceholderExpansion {
    private MoonCake plugins;

    public hook(MoonCake plugin) {
        this.plugins = plugin;
    }

    public boolean persist() {
        return true;
    }

    public boolean canRegister() {
        return true;
    }

    public String getAuthor() {
        return this.plugins.getDescription().getAuthors().toString();
    }

    public String getIdentifier() {
        return "mooncake";
    }

    public String getVersion() {
        return this.plugins.getDescription().getVersion();
    }

    public String onPlaceholderRequest(Player player, String identifier) {
        String p = player.getName() + ".MoonCake";
        if (identifier.equals("lr")) {
            return String.valueOf(Config.pd.get(p + ".0.amount"));
        }
        if (identifier.equals("wr")) {
            return String.valueOf(Config.pd.get(p + ".1.amount"));
        }
        if (identifier.equals("dh")) {
            return String.valueOf(Config.pd.get(p + ".2.amount"));
        }
        if (identifier.equals("bt")) {
            return String.valueOf(Config.pd.get(p + ".3.amount"));
        }
        if (identifier.equals("mg")) {
            return String.valueOf(Config.pd.get(p + ".4.amount"));
        }
        if (identifier.equals("gw")) {
            return String.valueOf(Config.pd.get(p + ".5.amount"));
        }
        if (identifier.equals("rs")) {
            return String.valueOf(Config.pd.get(p + ".6.amount"));
        }
        return "";
    }
}
